All Questions
Tagged with ruby-on-railsvalidation
20 questions
1vote
1answer
2kviews
better multiple fields validation on ruby/rails
I have a form for an item (Job Item), that has sets of 2 fields based on a type. field and field + _dolar e.g: ...
2votes
0answers
194views
jQuery validation for multi-page registration form
I use JS/JQuery validation for radioboxes, input field etc. Because of AJAX I use one global validation (in a separate file) and 4-5 other files to coverage actions in a relevant registration form ...
1vote
2answers
67views
3votes
1answer
80views
Ensure multiple steps work/saving multiple models via a service
I just thought of something new re: saving multiple objects in Rails (though Rails is not necessary). Objectives: Create an author and a tomato, but both of those must be valid. If invalid creation, ...
0votes
1answer
81views
Validating only attributes that are present in a form [closed]
I want to skip validations based on attributes. If certain attributes are not in form so I do not want to validate them. Currently, if I post them from one form which has 1 field, it still validates ...
3votes
1answer
1kviews
Rails form helper to display email fields and their validation errors
I have a repeated pattern throughout my app that looks like this: ...
2votes
1answer
2kviews
Preventing duplicate submission in Rails
I have a Rails app where doctors score patients on diagnosis - their score is the model Baseline. Each Baseline has a user id ...
3votes
1answer
3kviews
Rails validating enum
The Ruby on Rails framework doesn't allow you to validate enums submitted through a form in any sane manner. Evidently, enums are meant to be used to maintain internal application state, and are not ...
2votes
0answers
470views
Custom bang! method and Rails validation
I have a model called booking. ...
2votes
1answer
138views
Changing a user status flag, with validation
I am writing a function which on update of any attribute of model sets the status of variable is_kyc_verified to false. Here is the code of the User model and the ...
2votes
1answer
406views
Shipping address validations
In my journey of learning Rails, I'm wondering if I should test model validations. If so, is this a correct way to do it? ...
3votes
1answer
48views
Classes for attributes validation
I have two classes responsible for attributes validation: ...
6votes
1answer
4kviews
Using Rails concerns for validation in models
This is my first Rails project. I have read about concerns which are a great tool, but I am confused about how I should redesign my models. Some models have similar fields, but the validations are ...
5votes
2answers
10kviews
Checking for valid date range in Rails
I am getting a date range from form inputs - the "from" month, day, and year, and the "to" month, day, and year, and then running a report on data for within that date range. I want to first check ...
6votes
2answers
4kviews
Rails validating API parameters
I wanted to keep my API request logic separate form the controller logic. I therefore make use of a separate model (EmailChecker) that creates an instance of this ...